<script>

function nouveavance(){

id=$("input[name='ButterflyPortal_sys_rec']:checked").val();

$("#newavance_"+id).dialog({
autoOpen: true,
height: 160,
width: 400,
modal: true,
zIndex: 3999,
buttons: {
"Ajouter": function() {
montant=$("input[name='montant_"+id+"']").val();

savenewavance(id,montant);
$( this ).dialog( "close" );
},
Cancel: function() {
$( this ).dialog( "close" );
}
}


});
}


function savenewavance(fournisseurId,montant)
{

    $.get("/portlet.php",
        {app: "cabinet",
            operation:"savenewavancefournisseur",
            fournisseurId:fournisseurId,
            montant:montant
        },
        function(data){

            //alert(data);
            if (data=="ok") {


                // alert("Nouveau avance Ajouté");


            }else{

                alert("Problème survenu");
            }

        });



}
</script>